#ifndef SIMULATIONWORKFLOW_H_
#define SIMULATIONWORKFLOW_H_
//#include "Events.h"
//#include "Market.h"
//#include "User.h"
#include "Poco/DateTime.h"
#include <vector>
#include "CommonDef.h"
#include "MarketReport.h"
class Events;
class User;
class Market;
class Event;
using namespace std;
using namespace Poco;

class SimulationWorkFlow
{
	private:
		Events* events;
		User* Saya;
		vector<User*> users;
		Market* market;
		bool sayaON;
		int sayaBuyingAmount;
		CMarketReport marketReport;



		DateTime getCorrentDay();
//		bool isThereEventsLeft();
		void doAlltheCreateEventsForToday(DateTime today);
		void doCreateEvent(Event& event,string energyType);
		void doAlltheConsumingEventsForToday(DateTime today);
		void doConsumeEvent(Event& event ,string energyType);
		void doReportsEvent(DateTime today);
		void makeAllDealsForToday(DateTime today);
		void updateUserProfit();
		bool validBuyer(double price,string userID);
		bool validSeller(int amount,string userID,string energyType);
		void createSayaEvents(DateTime today);
		void doUserReport(Event report);
		void doEnergyReport(Event report);
		void doProfitReport(Event report);
		void doActivityReport(Event report);
		void doAccountReport(Event report);
		int stringToInt(string str);
		User& getUserbyID(string ID);

	public:
		SimulationWorkFlow(vector<User*>, Events*,bool sayaONOFF, int sayaBuyingAmount,string confingFile,string eventFile,double price );
		virtual ~SimulationWorkFlow();
		void run();



};

inline ass2::eEnergy operator++(ass2::eEnergy &energy)
{
	return energy = ass2::eEnergy(energy+1);
}

#endif /*SIMULATIONWORKFLOW_H_*/
